package pro.shushi.pamirs.hr.api.pmodel.eam;

import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxDetail;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTableSearch;
import pro.shushi.pamirs.hr.api.enums.eam.MmdTypeEnum;
import pro.shushi.pamirs.hr.api.enums.eam.MtoolPjTypeEnum;
import pro.shushi.pamirs.hr.api.model.eam.*;
import pro.shushi.pamirs.hr.api.model.org.Corporation;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.annotation.Prop;
import pro.shushi.pamirs.meta.enmu.ModelTypeEnum;

import java.util.List;

// 模型中UX开头的注解(UxForm/UxTable/UxDetail等)可以不用写，都可在设计器中进行可视化配置; 代码里面写这些注解是为了默认页面的交互
@Model.model(EamUkDtMtoolProxy.MODEL_MODEL)
@Model(displayName = "工装保养项目代理模型")
@Model.Advanced(type = ModelTypeEnum.PROXY)
public class EamUkDtMtoolProxy extends EamUkDt {

    public static final String MODEL_MODEL = "hr.simple.EamUkDtMtoolProxy";



    // ---------- 工装保养项明细 ----------------------
    @UxTableSearch.FieldWidget(@UxWidget())
    // 清除工装型号，自动清除mmdName
    @UxForm.FieldWidget(@UxWidget(config = {@Prop(name = "clearFields", value = "pjCode,pjName,pjType,ukMtd,ukStd"),
            @Prop(name = "constructData", value = "true"), @Prop(name = "constructSubmitType", value = "CURRENT"),
            @Prop(name = "constructFun", value = "constructPjCodeChange")}))
    @Field.one2one
    @Field.Relation(relationFields = {"orgCode","mmdCode","ukCycType"}, referenceFields = {"orgCode","mmdCode","ukCycType"}
//            ,domain = "orgCode==${activeRecord.eamUkHdMtoolProxy.orgCode} and mmdCode==${activeRecord.eamUkHdMtoolProxy.mmdCode} and ukCycType=={activeRecord.ukCycType}"
    )
    @Field(displayName = "项目编码", required = true, priority = 5L)
    private EamMtoolMtPj eamMtoolMtPj;

//    @Field.String
//    @Field.Related(related = {"eamMtoolMtPj", "mtoolPjType"})
//    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
//    @Field(displayName = "保养项类型", invisible = true)
//    public MtoolPjTypeEnum mtoolPjType;

    @Field.many2one
    @Field.Relation(relationFields = {"orgCode","ukCode"}, referenceFields = {"orgCode","ukCode"})
    @Field(displayName = "保养单", required = true)
    private EamUkHdMtoolProxy eamUkHdMtoolProxy;

    @Field.Related(related = {"eamUkHdMtoolProxy", "mmdCode"})
    @Field(displayName = "工装型号编码", invisible = true)
    private String mmdCode;





    // ---------- 工装保养项明细  ----------------------



}
